<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ include file="/page/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<%@ include file="/adapter/adapter-bootstrap.jsp" %>
<script type="text/javascript">
function  onLoad(){
	if(parseInt("${result}")>0){
		alert("保存成功");
	}else if(parseInt("${result}")<0){
		alert("保存失败");
	}
}

function  goBack(){
	//window.close();
	//window.history.back(-1);
	window.history.go(-1);
}

function  checkpic(){
	if($("#pic1").val()!=""&&$("#pic2").val()!=""){
		document.forms[1].submit();		
	}else{
	    alert("请上传所有图片！");
	}

}


function save(){
	var str_data=$("#paramTagform input").map(function(){
		   return ($(this).attr("name")+'='+$(this).val());
		 }).get().join("&") ;
    $.ajax({
        url:"${ctx}/sPageParamTag/saveSPageParamTag",
        type: "POST",      
        dataType:"json",
        data: str_data,
        async: false,
        success: function(data) {
        	if(data.flag>0){
	            alert("保存成功！");	
	            window.parent.location.reload(true);
        	}
        },
        error: function() {
          alert("error");
        }
      });
	
}

function  changeValue(elementType){
	   document.getElementById("tagType").value=elementType;	
}
/*  function ajaxRequest() {
    $.ajax({
      url: "${ctx}/uploadpic/one?appid=${appFrameStart.appId}",
      type: "POST",
      dataType: "json",
      data:$("#picinfo").serialize(),
      async: false,
      success: function(data) {
        alert("添加成功！");
        $.each(data, function(index, element) {
           window.location.reload();
        });
      },
      error: function() {
        alert("error");
      }
    });
  }  */
  
  function init(){
	  if('${recordKey}'!=""){
		  document.getElementById("recordKey").readOnly = true;
	  }
	  
	  if('${sPageParamTag.tagType}'!=""){
		  display('${sPageParamTag.tagType}');
	  }
  }
  
  function display(rkValue){
	  var  all_options=document.getElementById("elementType").options;
	  for(var i=0;i<all_options.length;i++){
		  if(all_options[i].value==rkValue){
			  all_options[i].selected = true;
		  }
	  }
  }
  
</script>
</head>
<body  onload="init()">
<div class="panel panel-default">
   <div class="panel-heading">
      <h3 class="panel-title">
          标签参数信息
      </h3>
   </div>
   <div class="panel-body">
<form class="form-horizontal" role="form" id="paramTagform"  action="${ctx}" method="post">
      <div class="form-group">
		<label for="recordKey" class="col-xs-2 control-label">标签唯一标识</label>
		<div class="col-xs-4">
		<input type="text" class="form-control" id="recordKey"  name="recordKey"      value="${recordKey}"   placeholder="">
	    </div>
	    <label for="pageId" class="col-xs-2 control-label">归属页面标识</label>
		<div class="col-xs-4">
		<input type="text" class="form-control" id="pageId"  name="pageId"  readonly="readonly" value="${pageId}"  placeholder="">
	    </div>
	  </div>   
	  <div class="form-group">
		<label for="templateParamCode" class="col-xs-2 control-label">归属参数代码</label>
		<div class="col-xs-4">
		<c:choose>
			<c:when test="${paramcode!='' && paramcode!=null}">
				<input type="text" class="form-control" id="templateParamCode"   name="templateParamCode"  readonly="readonly"  value="${paramcode}"   placeholder="">
			</c:when>
			<c:otherwise>
				<input type="text" class="form-control" id="templateParamCode"   name="templateParamCode"  readonly="readonly"  value="${sPageParamTag.templateParamCode}"   placeholder="">
			</c:otherwise>
		</c:choose>
	    </div>
	    <label for="tagName" class="col-xs-2 control-label"><c:choose><c:when test="${paramcode=='beanColumns'}">属性类型</c:when><c:otherwise>标签名称</c:otherwise></c:choose></label>
		<div class="col-xs-4">
		<input type="text" class="form-control" id="tagName"  name="tagName"     value="${sPageParamTag.tagName}"   placeholder="">
	    </div>
	  </div>
	  <div class="form-group">
		<label for="tagType" class="col-xs-2 control-label">标签类型</label>
		<div class="col-xs-4">
		<input type="hidden" class="form-control" id="tagType"  name="tagType"   value="${sPageParamTag.tagType}"  placeholder="">
	                         <select  class="form-control"  id="elementType" name="elementType"  onclick="changeValue(this.value)" >
	                              <option value="" >请选择</option> 
                                  <option value="001" >文本框</option> 
                                  <option value="002" >下拉框</option> 
                                  <option value="003" >日期框</option> 
                                  <option value="004" >密码框</option> 
                                  <option value="005" >备注框</option> 
                                  <option value="006" >按钮</option> 
                             </select>
	    
	    </div>
	    <label for="tagValueSrc" class="col-xs-2 control-label"><c:choose><c:when test="${paramcode=='beanColumns'}">属性名称</c:when><c:otherwise>标签取值</c:otherwise></c:choose></label>
		<div class="col-xs-4">
 		<input type="text" class="form-control" id="tagValueSrc"  name="tagValueSrc"  value="${sPageParamTag.tagValueSrc}" >
	    </div>
	 </div>   
<!-- 	  </form>	  --> 

	  <div class="form-group  text-center">
         <button type="button" class="btn btn-default"  onclick="save();">保存</button>
         <button type="button" class="btn btn-default"   onclick="history.go(-1)">返回</button>
<!--          </div>
      </div> -->
      </div>
 </form> 
   </div>
</div>

   

<%@ include file="/page/foot.html" %>
